{% extends 'base.html' %}
{% block content %}
<div class="col-sm-6">
{% if course_records %}
                      <section class="panel">
                          <header class="panel-heading">
                              {{ course_records.0.class_name }}
                          </header>
                          <table class="table table-striped">
                              <thead>
                              <tr>
                                  <th>#</th>
                                  <th>学员</th>
                                  <th>课时名</th>
                                  <th>老师</th>
                                  <th>签到</th>
                              </tr>
                              </thead>
                              <tbody>
                              {% for item in course_records %}
                              <tr>
                                  <td>{{ forloop.counter }}</td>
                                  <td>{{ name }}</td>
                                  <td>{{ item.course_content.name }}</td>
                                  <td>{{ item.teacher }}</td>


                                  <td>
                                      <!-- Button trigger modal -->
{#                                    <button type="button" class="btn btn-primary btn-sm" data-toggle="modal" data-target="#myModal" href="/apis/course_record/{{ item.id }}/">#}
                                    <div class="btn-group">
              <button type="button" class="btn btn-primary">签到</button>
              <button type="button" class="btn btn-primary dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
                <span class="caret"></span>
                <span class="sr-only">Toggle Dropdown</span>
              </button>
              <ul class="dropdown-menu">
                <li><a href="#">迟到</a></li>
                <li><a href="#">早退</a></li>
                <li><a href="#">请假</a></li>
                <li><a href="#">旷课</a></li>
              </ul>
              </div>
                              {% endfor %}

                              </tbody>
                          </table>
                      </section>
{% else %}
'没有数据'
{% endif %}

</div>
<!-- Modal -->
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
  <div class="modal-dialog" role="document">
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
        <h4 class="modal-title" id="myModalLabel">Modal title</h4>
      </div>
      <div class="modal-body">
        ... hello world
      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
        <button type="button" class="btn btn-primary">Save changes</button>
      </div>
    </div>
  </div>
</div>
{% endblock %}

{% block loadjs %}
<script>
$(function () {
    $('#myModal').on('hidden.bs.modal', function (e) {
        // do something...
        $(this).removeData("bs.modal");
    })
})
</script>
{% endblock %}